/*
 * $Id: IOnWatchService.java,v 1.5 2012/02/01 20:04:50 navdeep_mahajan Exp $
 * 
 * Copyright (C) 2008 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.onwatch.service;

import java.io.File;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ge.healthcare.autosc.common.database.dao.ICodeDetailsDAO;
import com.ge.healthcare.autosc.common.database.dao.IFileTransferDetailsDAO;
import com.ge.healthcare.autosc.common.database.dao.IRequestDAO;
import com.ge.healthcare.autosc.common.database.dao.IRequestListDAO;
import com.ge.healthcare.autosc.common.database.dao.IRequestTypeDAO;
import com.ge.healthcare.autosc.common.database.dao.ITaskDAO;
import com.ge.healthcare.autosc.common.database.dao.ITaskTypeDAO;
import com.ge.healthcare.autosc.common.database.pojo.ActRequestList;
import com.ge.healthcare.autosc.common.message.sender.MessageSender;
import com.ge.healthcare.autosc.common.pojo.sysInfo.SystemInfo;
import com.ge.healthcare.autosc.onwatch.bean.FileDownloadBean;
import com.ge.healthcare.autosc.onwatch.bean.FileUploadBean;
import com.ge.healthcare.autosc.onwatch.bean.HandshakeBean;
import com.ge.healthcare.autosc.onwatch.exception.OnWatchException;

public interface IOnWatchService {
	/**
	 * Handle file upload request against existing Onwatch task
	 * @param fileUploadBean
	 * @throws OnWatchException
	 */
	public void fileUploadForExistingTask(FileUploadBean fileUploadBean) throws OnWatchException;
	/**
	 * Handle file upload request as new request
	 * @param fileUploadBean
	 * @throws OnWatchException
	 */
	public void fileUploadForNewTask(FileUploadBean fileUploadBean) throws OnWatchException;
	
	/**
	 * Get download file from the back office
	 * @param fileDownloadBean
	 * @return	File object holding the requested file
	 * @throws OnWatchException
	 */
	@Transactional(propagation = Propagation.REQUIRES_NEW)
	public File getDownloadFile(FileDownloadBean fileDownloadBean) throws OnWatchException;
	
	/**
	 * Create Onwatch taskList in response to handshake request
	 * @param handshakeBean
	 * @returna Onwatch taskList in XML string
	 * @throws OnWatchException
	 */
	@Transactional(propagation = Propagation.REQUIRES_NEW)
	public String getOnwatchTaskList(HandshakeBean handshakeBean) throws OnWatchException;
	
	/**
	 * Set ActRequestListDAO
	 * @param requestListDAO
	 */
	public void setActRequestListDAO(IRequestListDAO requestListDAO);
	/**
	 * Set RequestTypeDAO
	 * @param requestTypeDAO
	 */
	public void setRequestTypeDAO(IRequestTypeDAO requestTypeDAO);
	/**
	 * Set ActRequsetDAO
	 * @param requestDAO
	 */
	public void setActRequestDAO(IRequestDAO requestDAO);
	/**
	 * Set ActTaskDAO
	 * @param taskDAO
	 */
	public void setActTaskDAO(ITaskDAO taskDAO);
	/**
	 * Set CodeDetailsDAO
	 * @param codeDetailsDAO
	 */
	public void setCodeDetailsDAO(ICodeDetailsDAO codeDetailsDAO);
	/**
	 * Set TaskTypeDAO
	 * @param taskTypeDAO
	 */
	public void setTaskTypeDAO(ITaskTypeDAO taskTypeDAO);
	/**
	 * Set MessageSender
	 * @param messageSender
	 */
	public void setMessageSender(MessageSender messageSender);
	/**
	 * Set ActFileTransferDetailsDAO
	 * @param fileTransferDetailsDAO
	 */
	public void setActFileTransferDetailsDAO(IFileTransferDetailsDAO fileTransferDetailsDAO);
	/**
	 * Create AutoSC ActRequestList, ActRequest and ActTask
	 * @param fileUploadBean
	 * @param systemInfo
	 * @return
	 */
	@Transactional(propagation = Propagation.REQUIRES_NEW)
	public ActRequestList createAutoscRequest(FileUploadBean fileUploadBean, SystemInfo systemInfo);
	
	/**
	 * Checks if the file is allowed for transfer or not
	 * @param systemId
	 * @param requestType
	 * @param fileName
	 * @param serviceId
	 * @param createdBy
	 * @return
	 */
	@Transactional(propagation = Propagation.REQUIRES_NEW)
	public boolean isAllowedForTransfer(String systemId, String requestType, String fileName, String serviceId, String createdBy);
}
